<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">

<!-- 
		Replace path to template, title, header and body
		with actual data.
	 -->
<ui:composition template="/auth/templates/template.xhtml">
	<ui:define name="pageTitle">Incluir Novo Pedido de Compra</ui:define>
	<ui:define name="body">
		<f:view>
			<p:growl id="messages" autoUpdate="true" closable="true"
				showDetail="true" />

			<h:form id="form">
				<h:panelGrid cellspacing="10px" styleClass="center">
					<f:facet name="header">Incluir Novo Pedido de Compra</f:facet>

					<p:pickList id="lista"
						value="#{novoPedidoCompraVSBean.itensPedidoCompra}"
						var="itempedidocompra"
						itemLabel="#{itempedidocompra.itemEstoque.produto.descricao}"
						itemValue="#{itempedidocompra}"
						converter="itemPedidoCompraPickListConverter">

						<f:facet name="sourceCaption">Itens Abertos</f:facet>
						<f:facet name="targetCaption">Itens Selecionados</f:facet>

						<p:ajax event="transfer" update=":form:txtvalortotal" />

					</p:pickList>

					<h:panelGroup>
						<h:outputText value="Valor Total:" />
						<h:outputText id="txtvalortotal"
							value="#{novoPedidoCompraVSBean.valorTotal}">
							<f:convertNumber currencyCode="BRL" minFractionDigits="2"
								type="currency" />
						</h:outputText>
					</h:panelGroup>

					<p:commandButton value="Enviar" icon="ui-icon-circle-arrow-e"
						update=":form" action="#{novoPedidoCompraVSBean.salvar}" />

				</h:panelGrid>

			</h:form>
		</f:view>
	</ui:define>
</ui:composition>

</html>